package com.yxhl.zoume.domain.interactor.pay;

import com.yxhl.zoume.data.http.repository.pay.PaymentRepository;
import com.yxhl.zoume.data.http.rest.param.base.RequestParamImpl;
import com.yxhl.zoume.data.http.rest.param.expresscar.ExpressCarBillDetailParam;
import com.yxhl.zoume.data.http.rest.response.expresscar.ExpressCarBillDetailResponse;
import com.yxhl.zoume.domain.DomainConstants;
import com.yxhl.zoume.domain.interactor.base.UseCase;

import javax.inject.Inject;
import javax.inject.Named;

import rx.Observable;
import rx.Scheduler;

/**
 * Created by vhawk on 12/22/16.
 */
public class ExpressCarBillDetailUseCase extends UseCase<ExpressCarBillDetailResponse> {
    private final PaymentRepository repository;

    @Inject
    public ExpressCarBillDetailUseCase(@Named(DomainConstants.UI_THREAD) Scheduler uiThread, @Named(DomainConstants.EXECUTOR_THREAD) Scheduler executorThread, PaymentRepository repository) {
        super(uiThread, executorThread);
        this.repository = repository;
    }

    @Override
    protected Observable<ExpressCarBillDetailResponse> buildObservable(RequestParamImpl param) {
        return repository.fetchExpressBillDetail((ExpressCarBillDetailParam) param)
                .observeOn(uiThread)
                .subscribeOn(executorThread);
    }
}
